package com.game.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.game.model.User;
import com.game.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zcl
 * @since 2020-11-13
 */
@RestController
@RequestMapping("/user")
public class UserController extends BaseController {
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    @Autowired
    private IUserService userService;
    @PostMapping("/getUser")
    public User getUser(){
        redisTemplate.boundHashOps("test:").put("a","b");
        return userService.getById(1);
    }


    @PostMapping("/findAllUser")
    public IPage<User> findAllUser(){

        return userService.page(getPage());
    }
}